<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"
    />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <title>Test</title>
</head>

<body>
    <input type="button" value="call func funcA" id="b1"/>
    <script language="javascript" type="text/javascript" src="./bridge.js"></script>
    <script>
        window.bridge.registerNotification("notify1", function (data) {
            console.log(data);
        });

        window.bridge.registerNotification("notify2", function (data) {
            console.log(data);
        });

        window.bridge.register("jsFunc1", function (data, callback) {
            console.log(data);
            if (callback) callback("return from jsfunc1");
        });

        window.bridge.register("jsFunc2", function (data, callback) {
            console.log(data);
            if (callback) callback("return from jsfunc2");
        });

        document.getElementById('b1').addEventListener('click', function() {
            window.bridge.call('native1', 'from js data', function(data) {
                console.log(data);
            })
        })

        function func(str) {
            console.log(str);
        }
    </script>
</body>

</html>